require "kuru_wrap.lua"
Makeup3Config = {
{path='Makeup3/filter/filter/clean_down_pink.dat',type=6,filterName='clean_down_pink.dat',intensity=0.8},
{path='Makeup3/img/img/f_skin_4.png',type=3,scale=1,tx=0,ty=0,blendmode=BlendMode.Normal},
{path='Makeup3/img/img/skin.png',type=2,blendmode=BlendMode.Normal},
{path='Makeup3/img/img/f_cherry_cheek',type=1,scale=0.2,tx=-0.32,ty=0.01,anchor=KaleStickerNodeAnchorType.CENTER,location=KaleStickerNodeLocationType.FACE,flip=false,fps=20,blendmode=BlendMode.Normal},
{path='Makeup3/img/img/f_cherry_cheek',type=1,scale=0.2,tx=0.32,ty=0.01,anchor=KaleStickerNodeAnchorType.CENTER,location=KaleStickerNodeLocationType.FACE,flip=false,fps=20,blendmode=BlendMode.Normal},
{path='Makeup3/img/img/b_cherry_cherry',type=0,scale=1,tx=0,ty=0,anchor=KuruBackgroundImageNodeAnchorType.CENTER,stretch=KuruBackgroundImageNodeStretch.UNIFORM_FILL,fps=20,blendmode=BlendMode.None},
}

Makeup3 = {}

function Makeup3:new(scene)
    instance = {}
    setmetatable(instance, self)
    self.__index = self

    instance.scene = scene
    instance.snap = instance:setSnapshot()
    instance.config = {}
    instance.makeup = instance:Initialize() or nil
    
    instance.nodes=instance:createNodes()
    instance.oldLipLayerBlendModes = {nil, nil, nil}
    instance.lipLayers = {nil, nil, nil}
   
    instance.sampler = instance:createSampler()
    instance.configNum = instance:getconfigNum()

    return instance
end
-- function Makeup3:reBuildLipLayers(scene)

-- end
function Makeup3:Initialize()

end
function Makeup3:FrameReady(elapsedTime)

end
function Makeup3:createNodes()
    self.config = Makeup3Config
    g_nodes = {}
    for i = 1, #self.config do
        g_nodes[i] = KuruWrap.addNodeWithConfig(self.scene, self.config[i])
    end
    return g_nodes
end

function Makeup3:getNodes()
    return self.nodes
end

function Makeup3:getconfigNum()
    return #self.config
end

function Makeup3:getSampler()
    return self.sampler
end

function Makeup3:createSampler()
    node = KuruSnapshotNode.create()
    self.scene:addNode(node)
    node:release()
    return node:getSnapshot()
end

function Makeup3:setSnapshot()
    node = KuruSnapshotNode.create()
    self.scene:addNode(node)
    node:release()
    return node
end
function Makeup3:Clear()
    passThroughNode = KuruShaderFilterNode.createWithFragmentShaderFile(BASE_DIRECTORY .. "passthrough.frag", true)
    self.scene:addNodeAndRelease(passThroughNode)
    passThroughNode:setChannel0(self.snap:getSnapshot())
end
